From c3cafabc093ae357f6f7ef60f419c2e354ed1d86 Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Tue, 18 Jun 2019 08:33:01 -0600 Subject: [PATCH] resharper fixes (#368) * fix "redundant statement", "redundant declaration" * fix newline at eof. --- alan.cc | 14 ++--- easygps.cc | 1 - garmin_gpi.cc | 2 +- garmin_xt.cc | 4 +- gpx.cc | 4 +- gui/advdlg.h | 2 +- gui/babeldata.h | 2 +- gui/dpencode.cc | 2 +- gui/filterdata.h | 4 +- gui/filterwidgets.h | 4 +- gui/format.h | 66 ++++++++++++-------- gui/formatload.h | 4 +- gui/gpx.cc | 18 +++--- gui/gpx.h | 137 ++++++++++++++++++++++++----------------- gui/mainwindow.cc | 2 +- gui/map.h | 2 +- gui/processwait.cc | 21 ++++--- gui/processwait.h | 2 +- gui/setting.h | 4 +- jeeps/gpsapp.cc | 2 +- jeeps/gpsserial.cc | 2 +- jeeps/gpsusbcommon.cc | 2 +- pcx.cc | 1 - route.cc | 2 +- src/core/file.h | 2 +- src/core/textstream.cc | 2 +- src/core/textstream.h | 2 +- xmlgeneric.cc | 2 +- 28 files changed, 177 insertions(+), 135 deletions(-) diff --git a/alan.cc b/alan.cc index 020c48fd2..0a88e6007 100644 --- a/alan.cc +++ b/alan.cc @@ -490,11 +490,11 @@ static Waypoint* get_wpt(struct wprdata* wprdata, unsigned n) WP->latitude = -pt2deg(wpt->pt.y); WP->longitude = pt2deg(wpt->pt.x); WP->SetCreationTime(unpack_time(wpt->date, wpt->time)); - for (j=WPT_NAME_LEN-1; j >= 0 && wpt->name[j] == ' '; j--) {}; + for (j=WPT_NAME_LEN-1; j >= 0 && wpt->name[j] == ' '; j--) {} char *s = xstrndup(wpt->name,j+1); WP->shortname = s; xfree(s); - for (j=WPT_COMMENT_LEN-1; j >= 0 && wpt->comment[j] == ' '; j--) {}; + for (j=WPT_COMMENT_LEN-1; j >= 0 && wpt->comment[j] == ' '; j--) {} if (j >= 0) { char *s = xstrndup(wpt->comment, j+1); WP->description = s; @@ -541,11 +541,11 @@ static void wpr_read() route_head* RT = route_head_alloc(); RT->rte_num = i; - for (j=RTE_NAME_LEN-1; j >= 0 && rte->name[j] == ' '; j--) {}; + for (j=RTE_NAME_LEN-1; j >= 0 && rte->name[j] == ' '; j--) {} char *s = xstrndup(rte->name,j+1); RT->rte_name = s; xfree(s); - for (j=RTE_COMMENT_LEN-1; j >= 0 && rte->comment[j] == ' '; j--) {}; + for (j=RTE_COMMENT_LEN-1; j >= 0 && rte->comment[j] == ' '; j--) {} if (j >= 0) { char *s = xstrndup(rte->comment,j+1); RT->rte_desc = s; @@ -595,14 +595,14 @@ static void trl_read() route_head* TL = route_head_alloc(); for (j=TRK_NAME_LEN-1; j >= 0 && (trkhdr->name[j] == ' ' || trkhdr->name[j] == '\0'); - j--) {}; + j--) {} char *s1 = xstrndup(trkhdr->name,j+1); TL->rte_name = s1; xfree(s1); /* TL->rte_name[TRK_NAME_LEN+1] = 0; */ /* MAYBE BAD ADDRESS (Valgrind) */ for (j=TRK_COMMENT_LEN-1; j >= 0 && (trkhdr->comment[j] == ' ' || trkhdr->comment[j] == '\0'); - j--) {}; + j--) {} s1 = xstrndup(trkhdr->comment,j+1); TL->rte_desc = s1; xfree(s1); @@ -791,7 +791,7 @@ static void trl_track_hdr(const route_head* TL) struct trkhdr* trkhdr = TRL.loghdr.trkhdr; - for (idx=0; idx< MAXTRK && trkhdr[idx].occupied != TRK_UNUSED; idx++) {}; + for (idx=0; idx< MAXTRK && trkhdr[idx].occupied != TRK_UNUSED; idx++) {} if (idx >= MAXTRK) { fatal(MYNAME ": Can't store more than %u tracklogs", MAXTRK); } diff --git a/easygps.cc b/easygps.cc index 52bf2b552..c6ff725c5 100644 --- a/easygps.cc +++ b/easygps.cc @@ -136,7 +136,6 @@ data_read() break; default: printf("Unknown tag %x\n", tag); - ; } } if (!link.url_.isEmpty() || !link.url_link_text_.isEmpty()) { diff --git a/garmin_gpi.cc b/garmin_gpi.cc index 0452b198f..bddea7fba 100644 --- a/garmin_gpi.cc +++ b/garmin_gpi.cc @@ -1583,7 +1583,7 @@ garmin_gpi_read() if (! read_tag("garmin_gpi_read", tag, nullptr)) { return; } - }; + } } diff --git a/garmin_xt.cc b/garmin_xt.cc index 7406cc9f2..4d3ac4caa 100644 --- a/garmin_xt.cc +++ b/garmin_xt.cc @@ -365,11 +365,11 @@ format_garmin_xt_proc_atrk() double LatF = Lat; if (LatF>8388608) { LatF -= 16777216; - }; + } double LonF = Lon; if (LonF>8388608) { LonF -= 16777216; - }; + } double AltF = (double)uu * GARMIN_XT_ELE - 1500; //create new waypoint diff --git a/gpx.cc b/gpx.cc index 88c3009db..5f126a840 100644 --- a/gpx.cc +++ b/gpx.cc @@ -247,12 +247,12 @@ gpx_add_to_global(QStringList& ge, const QString& s) static inline QString toString(double d) { return QString::number(d, 'f', 9); -}; +} static inline QString toString(float f) { return QString::number(f, 'f', 6); -}; +} /* diff --git a/gui/advdlg.h b/gui/advdlg.h index 10b6c24eb..bf4fe7a1b 100644 --- a/gui/advdlg.h +++ b/gui/advdlg.h @@ -36,7 +36,7 @@ public: QPushButton* formatButton() { return ui_.formatButton; - }; + } private: Ui_AdvUi ui_; diff --git a/gui/babeldata.h b/gui/babeldata.h index 9f58cc626..198f88893 100644 --- a/gui/babeldata.h +++ b/gui/babeldata.h @@ -71,7 +71,7 @@ public: disableDonateDialog_(false), donateSplashed_(QDateTime(QDate(2010, 1, 1), QTime(0, 0, 0))) { - }; + } void saveSettings(QSettings& st) { diff --git a/gui/dpencode.cc b/gui/dpencode.cc index 882cc70a7..fc07855ae 100644 --- a/gui/dpencode.cc +++ b/gui/dpencode.cc @@ -100,7 +100,7 @@ void PolylineEncoder::createEncodings(string& encoded_points, const vector & points, const vector & dists) { - encoded_points = "";; + encoded_points = ""; int plat = 0; int plng = 0; for (unsigned int i = 0; i < points.size(); i++) { diff --git a/gui/filterdata.h b/gui/filterdata.h index 513249306..21310c8f9 100644 --- a/gui/filterdata.h +++ b/gui/filterdata.h @@ -33,8 +33,8 @@ class FilterData { public: - FilterData(): inUse_(true) {}; - virtual ~FilterData() {}; + FilterData(): inUse_(true) {} + virtual ~FilterData() {} void saveSettings(QSettings& st) { diff --git a/gui/filterwidgets.h b/gui/filterwidgets.h index 10a1c0ab1..15ee0f8f7 100644 --- a/gui/filterwidgets.h +++ b/gui/filterwidgets.h @@ -93,8 +93,8 @@ private: class FilterOption { public: - FilterOption() {}; - virtual ~FilterOption() {}; + FilterOption() {} + virtual ~FilterOption() {} virtual void setWidgetValue() = 0; virtual void getWidgetValue() = 0; }; diff --git a/gui/format.h b/gui/format.h index 708bcbda4..9954d492d 100644 --- a/gui/format.h +++ b/gui/format.h @@ -110,15 +110,17 @@ public: void setValue(QVariant v) { value_ = v; - }; + } + void setSelected(bool v) { isSelected_ = v; - }; + } + QString getHtml() const { return html_; - }; + } private: QString name_; @@ -155,7 +157,7 @@ public: { inputOptions_.clear(); outputOptions_.clear(); - }; + } Format(const QString& name, const QString& description, @@ -196,93 +198,107 @@ public: { } - ~Format() {}; + ~Format() {} bool isReadWaypoints() const { return readWaypoints_; - }; + } + bool isReadTracks() const { return readTracks_; - }; + } + bool isReadRoutes() const { return readRoutes_; - }; + } + bool isReadSomething() const { return isReadWaypoints() || isReadTracks() || isReadRoutes(); - }; + } bool isWriteWaypoints() const { return writeWaypoints_; - }; + } + bool isWriteTracks() const { return writeTracks_; - }; + } + bool isWriteRoutes() const { return writeRoutes_; - }; + } + bool isWriteSomething() const { return isWriteWaypoints() || isWriteTracks() || isWriteRoutes(); - }; + } QString getName() const { return name_; - }; + } + QString getDescription() const { return description_; - }; + } + QString getHtml() const { return html_; - }; + } + QStringList getExtensions() const { return extensions_; - }; + } + const QList& getInputOptions() const { return inputOptions_; - }; + } + const QList& getOutputOptions() const { return outputOptions_; - }; + } QList* getInputOptionsRef() { return &inputOptions_; - }; + } + QList* getOutputOptionsRef() { return &outputOptions_; - }; + } bool isDeviceFormat() const { return deviceFormat_; - }; + } + bool isFileFormat() const { return fileFormat_; - }; + } bool isHidden() const { return hidden_; - }; + } + void setHidden(bool state) { hidden_ = state; - }; + } void saveSettings(QSettings& settings); void restoreSettings(QSettings& settings); diff --git a/gui/formatload.h b/gui/formatload.h index 6aa5cc6f8..6df76043d 100644 --- a/gui/formatload.h +++ b/gui/formatload.h @@ -33,8 +33,8 @@ class FormatLoad { public: - FormatLoad() : currentLine_(0) {}; - ~FormatLoad() {}; + FormatLoad() : currentLine_(0) {} + ~FormatLoad() {} bool getFormats(QList& formatList); private: diff --git a/gui/gpx.cc b/gui/gpx.cc index 2a876f9f1..e5355dcc8 100644 --- a/gui/gpx.cc +++ b/gui/gpx.cc @@ -80,8 +80,8 @@ public: { if (localName == "wpt") { currentWpt = GpxWaypoint(); - double lat = atts.value("lat").toDouble();; - double lon = atts.value("lon").toDouble();; + double lat = atts.value("lat").toDouble(); + double lon = atts.value("lon").toDouble(); currentWpt.setLocation(LatLng(lat, lon)); stateStack << state; state = e_wpt; @@ -101,8 +101,8 @@ public: else if (localName == "trkpt") { currentTrkPt = GpxTrackPoint(); - double lat = atts.value("lat").toDouble();; - double lon = atts.value("lon").toDouble();; + double lat = atts.value("lat").toDouble(); + double lon = atts.value("lon").toDouble(); currentTrkPt.setLocation(LatLng(lat, lon)); stateStack << state; state = e_trkpt; @@ -116,8 +116,8 @@ public: else if (localName == "rtept") { currentRtePt = GpxRoutePoint(); - double lat = atts.value("lat").toDouble();; - double lon = atts.value("lon").toDouble();; + double lat = atts.value("lat").toDouble(); + double lon = atts.value("lon").toDouble(); currentRtePt.setLocation(LatLng(lat, lon)); stateStack << state; state = e_rtept; @@ -132,7 +132,7 @@ public: //localName.toStdString().c_str(), qName.toStdString().c_str()); } return true; - }; + } bool endElement(const QString& /*namespaceURI*/, const QString& localName, @@ -205,13 +205,13 @@ public: //localName.toStdString().c_str(), qName.toStdString().c_str()); } return true; - }; + } bool characters(const QString& x) override { textChars = x; return true; - }; + } }; diff --git a/gui/gpx.h b/gui/gpx.h index d2f1eab27..2bd140765 100644 --- a/gui/gpx.h +++ b/gui/gpx.h @@ -31,17 +31,18 @@ class GpxItem { public: - GpxItem(): visible(true) {}; - GpxItem(bool visible): visible(visible) {}; + GpxItem(): visible(true) {} + GpxItem(bool visible): visible(visible) {} void setVisible(bool b) { visible = b; - }; + } + bool getVisible() const { return visible; - }; + } protected: bool visible; @@ -53,24 +54,27 @@ class GpxRoutePoint: public GpxItem public: GpxRoutePoint(): GpxItem(), location(LatLng()), name(QString()) { - }; + } + void setLocation(const LatLng& pt) { location = pt; - }; + } + LatLng getLocation() const { return location; - }; + } void setName(const QString& s) { name = s; - }; + } + QString getName() const { return name; - }; + } private: LatLng location; @@ -81,7 +85,7 @@ private: class GpxRoute: public GpxItem { public: - GpxRoute(): GpxItem(),name(QString()), cachedLength(-1) {}; + GpxRoute(): GpxItem(),name(QString()), cachedLength(-1) {} GpxRoute(const GpxRoute& c) :GpxItem(c.visible), @@ -130,16 +134,18 @@ public: void setName(const QString& s) { name = s; - }; + } + QString getName() const { return name; - }; + } void clear() { routePoints.clear(); - }; + } + void addPoint(const GpxRoutePoint& pt) { routePoints << pt; @@ -147,7 +153,7 @@ public: const QList& getRoutePoints() const { return routePoints; - }; + } private: QString name; @@ -161,33 +167,37 @@ class GpxTrackPoint: public GpxItem public: GpxTrackPoint(): GpxItem(), location(LatLng()), elevation(0), dateTime(QDateTime()) { - }; + } + void setLocation(const LatLng& pt) { location = pt; - }; + } + LatLng getLocation() const { return location; - }; + } void setElevation(double e) { elevation = e; - }; + } + double getElevation() const { return elevation; - }; + } void setDateTime(const QDateTime& dt) { dateTime = dt; - }; + } + QDateTime getDateTime() const { return dateTime; - }; + } private: LatLng location; @@ -199,7 +209,8 @@ private: class GpxTrackSegment: public GpxItem { public: - GpxTrackSegment() {}; + GpxTrackSegment() {} + GpxTrackSegment(const GpxTrackSegment& c): GpxItem(c.visible) { trackPoints.clear(); @@ -223,11 +234,12 @@ public: void clear() { trackPoints.clear(); - }; + } + const QList& getTrackPoints() const { return trackPoints; - }; + } private: QList trackPoints; @@ -236,7 +248,7 @@ private: class GpxTrack: public GpxItem { public: - GpxTrack(): GpxItem(), number(1), name(QString()), comment(QString()), description(QString()), cachedLength(-1.0) {}; + GpxTrack(): GpxItem(), number(1), name(QString()), comment(QString()), description(QString()), cachedLength(-1.0) {} GpxTrack(const GpxTrack& c) :GpxItem(c.visible), @@ -269,43 +281,48 @@ public: void setNumber(int n) { number = n; - }; + } + int getNumber() const { return number; - }; + } void setName(const QString& s) { name = s; - }; + } + QString getName() const { return name; - }; + } void setComment(const QString& s) { comment = s; - }; + } + QString getComment() const { return comment; - }; + } void setDescription(const QString& s) { description = s; - }; + } + QString getDescription() const { return description; - }; + } void clear() { trackSegments.clear(); - }; + } + void addSegment(const GpxTrackSegment& seg) { trackSegments << seg; @@ -313,7 +330,7 @@ public: const QList& getTrackSegments() const { return trackSegments; - }; + } double length() const { @@ -360,61 +377,67 @@ public: comment_(QString()), description_(QString()), symbol_(QString()) - {}; + {} void setLocation(const LatLng& pt) { location_ = pt; - }; + } + LatLng getLocation() const { return location_; - }; + } void setElevation(double e) { elevation_ = e; - }; + } + double getElevation() const { return elevation_; - }; + } void setName(const QString& s) { name_ = s; - }; + } + QString getName() const { return name_; - }; + } void setComment(const QString& s) { comment_ = s; - }; + } + QString getComment() const { return comment_; - }; + } void setDescription(const QString& s) { description_ = s; - }; + } + QString getDescription() const { return description_; - }; + } void setSymbol(const QString& s) { symbol_ = s; - }; + } + QString getSymbol() const { return symbol_; - }; + } private: LatLng location_; @@ -429,34 +452,38 @@ private: class Gpx { public: - Gpx() {}; + Gpx() {} bool read(const QString& fileName); QList & getWaypoints() { return wayPoints; - }; // nonconst + } // nonconst + QList & getTracks() { return tracks; - }; + } + QList & getRoutes() { return routes; - }; + } const QList & getWaypoints() const { return wayPoints; - }; + } + const QList & getTracks() const { return tracks; - }; + } + const QList & getRoutes() const { return routes; - }; + } private: QList wayPoints; diff --git a/gui/mainwindow.cc b/gui/mainwindow.cc index 1f85152d7..df5d5e50d 100644 --- a/gui/mainwindow.cc +++ b/gui/mainwindow.cc @@ -1347,7 +1347,7 @@ QString MainWindow::getFormatNameForExtension(const QString& ext) QStringList extensions = formatList_[i].getExtensions(); for (int j = 0; j < extensions.size(); ++j) { if (extensions[j] == ext) { - return formatList_[i].getName();; + return formatList_[i].getName(); } } } diff --git a/gui/map.h b/gui/map.h index 92fcf8761..cced27bfc 100644 --- a/gui/map.h +++ b/gui/map.h @@ -43,7 +43,7 @@ class MarkerClicker: public QObject Q_OBJECT public: - MarkerClicker(QObject* parent): QObject(parent) {}; + MarkerClicker(QObject* parent): QObject(parent) {} public slots: void clickedX(int t, int i) diff --git a/gui/processwait.cc b/gui/processwait.cc index 4671d2ff2..8ae5806f4 100644 --- a/gui/processwait.cc +++ b/gui/processwait.cc @@ -123,25 +123,26 @@ ProcessWaitDialog::~ProcessWaitDialog() bool ProcessWaitDialog::getExitedNormally() { return (errorString_.length() == 0); -}; +} //------------------------------------------------------------------------ QString ProcessWaitDialog::getErrorString() { return errorString_; -}; +} //------------------------------------------------------------------------ int ProcessWaitDialog::getExitCode() { return ecode_; -}; +} //------------------------------------------------------------------------ void ProcessWaitDialog::stopClickedX() { process_->terminate(); -}; +} + //------------------------------------------------------------------------ void ProcessWaitDialog::timeoutX() { @@ -157,7 +158,7 @@ void ProcessWaitDialog::timeoutX() timer_->stop(); accept(); } -}; +} //------------------------------------------------------------------------ void ProcessWaitDialog::errorX(QProcess::ProcessError err) @@ -165,7 +166,7 @@ void ProcessWaitDialog::errorX(QProcess::ProcessError err) errorString_ = processErrorString(err); timer_->stop(); accept(); -}; +} //------------------------------------------------------------------------ void ProcessWaitDialog::finishedX(int exitCode, QProcess::ExitStatus es) @@ -176,7 +177,7 @@ void ProcessWaitDialog::finishedX(int exitCode, QProcess::ExitStatus es) } timer_->stop(); accept(); -}; +} //------------------------------------------------------------------------ @@ -205,16 +206,16 @@ void ProcessWaitDialog::readyReadStandardErrorX() { QByteArray d = process_->readAllStandardError(); appendToText(d.data()); -}; +} //------------------------------------------------------------------------ void ProcessWaitDialog::readyReadStandardOutputX() { QByteArray d = process_->readAllStandardOutput(); appendToText(d.data()); -}; +} void ProcessWaitDialog::closeEvent(QCloseEvent* event) { event->ignore(); -}; +} diff --git a/gui/processwait.h b/gui/processwait.h index 2faf6f7bf..1cce33727 100644 --- a/gui/processwait.h +++ b/gui/processwait.h @@ -52,7 +52,7 @@ public: QString getOutputString() const { return outputString_; - }; + } protected: void closeEvent(QCloseEvent* event); diff --git a/gui/setting.h b/gui/setting.h index 89770cfa3..0f111c991 100644 --- a/gui/setting.h +++ b/gui/setting.h @@ -31,8 +31,8 @@ class VarSetting { public: - VarSetting() {}; - virtual ~VarSetting() {}; + VarSetting() {} + virtual ~VarSetting() {} virtual void saveSetting(QSettings&) = 0; virtual void restoreSetting(QSettings&) = 0; diff --git a/jeeps/gpsapp.cc b/jeeps/gpsapp.cc index df113da65..e8a636759 100644 --- a/jeeps/gpsapp.cc +++ b/jeeps/gpsapp.cc @@ -2490,7 +2490,7 @@ static void GPS_D109_Send(UC* data, GPS_PWay way, int32* len, int protoid) } } - GPS_Util_Put_Short(p, (US) way->category);; /* D110 category */ + GPS_Util_Put_Short(p, (US) way->category); /* D110 category */ p += 2; } diff --git a/jeeps/gpsserial.cc b/jeeps/gpsserial.cc index 15ca36914..36de12475 100644 --- a/jeeps/gpsserial.cc +++ b/jeeps/gpsserial.cc @@ -279,7 +279,7 @@ int32 GPS_Serial_Set_Baud_Rate(gpsdevh* fd, int br) tio.DCBlength = sizeof(DCB); GetCommState(wsd->comport, &tio); - tio.BaudRate = speed;; + tio.BaudRate = speed; if (!SetCommState(wsd->comport, &tio)) { GPS_Serial_Error("SetCommState on port for alternate bit rate failed"); CloseHandle(wsd->comport); diff --git a/jeeps/gpsusbcommon.cc b/jeeps/gpsusbcommon.cc index e8f17a5df..f85e555fd 100644 --- a/jeeps/gpsusbcommon.cc +++ b/jeeps/gpsusbcommon.cc @@ -125,7 +125,7 @@ top: if ((rv == 0) && (receive_state == rs_frombulk)) { m1= "RET2INTR"; m2=nullptr; - }; + } GPS_Diag("(%-8s%s)\n", m1, m2 ? m2 : ""); } diff --git a/pcx.cc b/pcx.cc index 11dc8e171..e3e4aa777 100644 --- a/pcx.cc +++ b/pcx.cc @@ -286,7 +286,6 @@ static void data_read() { } break; default: break; - ; } } } diff --git a/route.cc b/route.cc index e1885ce00..78d2bc763 100644 --- a/route.cc +++ b/route.cc @@ -385,7 +385,7 @@ route_head::route_head() : line_width(-1), session(curr_session()) { -}; +} route_head::~route_head() { diff --git a/src/core/file.h b/src/core/file.h index d27221a7b..60c5d2c8e 100644 --- a/src/core/file.h +++ b/src/core/file.h @@ -60,6 +60,6 @@ public: }; -}; // namespace gpsbabel +} // namespace gpsbabel #endif // SRC_CORE_FILE_INCLUDED_H_ diff --git a/src/core/textstream.cc b/src/core/textstream.cc index afbc7b615..a1528cac5 100644 --- a/src/core/textstream.cc +++ b/src/core/textstream.cc @@ -65,4 +65,4 @@ void TextStream::close() codec_ = nullptr; } -}; // namespace +} // namespace diff --git a/src/core/textstream.h b/src/core/textstream.h index bcfaa64ab..d1d40b193 100644 --- a/src/core/textstream.h +++ b/src/core/textstream.h @@ -40,4 +40,4 @@ private: QTextCodec* codec_{nullptr}; }; -}; // namespace +} // namespace diff --git a/xmlgeneric.cc b/xmlgeneric.cc index febcb8afc..9bd9ae91e 100644 --- a/xmlgeneric.cc +++ b/xmlgeneric.cc @@ -160,7 +160,7 @@ xml_run_parser(QXmlStreamReader& reader) default: break; - }; + } readnext: // readNextStartElement will cause a "Premature end of document." error -- 2.30.2